import time
from datetime import datetime,timedelta

def str2date(strtime):
    today = datetime.now().strftime("%Y-%m-%d ")
    nowtime = today + strtime + ':00'
    return datetime.strptime(nowtime, '%Y-%m-%d %H:%M:%S')

def date2int(date,hour):
    # timeStamp = int(time.mktime(time.localtime(date)))+hour*3600
    timeStamp = int(time.mktime(time.strptime(date.strftime('%Y-%m-%d %H:%M:%S'), '%Y-%m-%d %H:%M:%S')))+int(float(hour)*3600)
    return time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(timeStamp))
